package de.koller.balance.scene.blackCube;

import de.koller.aframe.gl.ATexture;
import de.koller.aframe.gl.Camera;
import de.koller.aframe.gl.obj.Quad;
import de.koller.altitude.render.textures.GridTexture;
import de.koller.balance.render.BRenderExt;
import de.koller.oceanFramework.math.RVec3;
import org.lwjgl.opengl.GL11;

public class BlackCubeScene extends BRenderExt {
	
	private ATexture grid = new GridTexture();
	private Quad quad = Quad.createXPlane( -1, -1, 0, 2, 2 ).setTextureLayout( 1, 1 );
	
	public final Camera camera = new Camera();
	
	private void initCamera() {
		commonUses.setUpPerspective();
		
		GL11.glPushMatrix();
		//camera.position.set( 0.8f, 1.8f, 1.8f );
		camera.position.set( 0, 0, 5 );
		camera.setLookAt( new RVec3( 0, 0, 0 ) );
		camera.up.set( 0, 1, 0 );
		camera.transformGL();
	}
	
	private void popCamera() {
		GL11.glPopMatrix();
	}

	@Override
	public void renderSzene() {
		initCamera();
		
		grid.bindAnisotrophic();
		quad.renderStructure();
		
		popCamera();
	}
	
}
